package com.sys.servlet;

import com.sys.dao.sysDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "getItemServlet", urlPatterns = "/sys/getItem", description = "获取所有物资")
public class getItemServlet extends sysServlet {
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    setHeadHtml(req, resp, "getItemServlet");
    sysDao dao = new sysDao();
    PrintWriter out = resp.getWriter();
    int itemType = 9999;
    try {
      itemType = Integer.valueOf(req.getParameter("itemType"));
    } catch (Exception ignored) {}

    dao.getItem(itemType, out::print);
  }
}
